<template>
  <div style="position:relative">
    <img class="contentMaoboli" :style="{height:fullheight+'rem'}" style="width:3.75rem;position:absolute;object-fit: cover;" :src="item.image"></img>
    <div  :style="{height:fullheight+'rem'}" style="width:3.75rem;position:absolute;background-color:rgba(0,0,0,0.5)" ></div>
    <div class="mw-column-style" style="position:absolute;margin-left:0.2rem;margin-top: 0.36rem;width:3.35rem;background-color: #ffffff;border-radius: 0.2rem;" :style="{height:fullheight - 0.64+'rem'}">
      <div style="width: 100%;border-radius:0.2rem 0.2rem 0 0;position: absolute;" :style="{height:fullheight - 0.64 - 2.35 + 1.36+'rem'}">
        <img style="width:100%;;height:100%;;object-fit:cover;border-radius:0.2rem 0.2rem 0 0;" :src="item.image"></img>
      </div>
      <div class="mw-column-center-style" style="position: absolute;bottom:0;padding:0.08rem 0.1rem 0.1rem 0.1rem;justify-content:flex-end;margin-top:-0.16rem;border-radius:0.2rem;background-color: #ffffff;width:3.15rem;">
        <div style="width:0.55rem;height:0.04rem;background:rgba(235,235,235,1);border-radius:0.02rem;"></div>
        <div class="mw-row-spacebetween-style" style="margin-top:0.03rem;width:3.15rem;align-items: center;height:0.44rem;font-size: 0.30rem;">
          <div class="mw-column-style" style="height:100%;justify-content: space-around">
            <div class="mw-row-style" style="align-items: center">
              <div class="mw-row-style mw-main-red" style="font-weight: bold;align-items: baseline">
                <div v-if="item.coupon_amount != 0" style="font-size: 0.12rem">券后</div>
                <div style="font-size: 0.12rem">￥</div>
                <div style="font-size: 0.22rem">{{item.price}}</div>
              </div>
              <div v-if="item.coupon_amount != 0" class="mw-column-center-style" style="margin-left:0.04rem;justify-content:center;font-size:0.1rem;color:#ffffff;padding:0 0.1rem;height:0.16rem;background-image: url(/static/coupon_icon.png);background-repeat:no-repeat; background-size:100% 100%;-moz-background-size:100% 100%;}
">{{item.coupon_amount}}元券
              </div>
            </div>

            <div class="mw-row-style mw-third-text-color" style="font-size: 0.11rem">
              <div style="margin-right:0.04rem">{{item.platform}}</div>
              <div style="text-decoration:line-through">￥{{item.original_price}}</div>
            </div>
          </div>
          <div @click.stop="sendClickBuy(item)" class="mw-column-center-style" style="justify-content:center;width:0.71rem;height:0.44rem;border-radius: 0.12rem;background-color: #ED3D5D">
            <div style="color: #ffffff;font-size: 0.2rem;margin-bottom:0.04rem;">抢购</div>
            <div style="color: #ffffff;font-size: 0.09rem">{{item.click_total < 10000 ? item.click_total : (Math.floor(item.click_total/10000 * 10) / 10 + 'w')}}已抢</div>
          </div>
          <!--<div class="mw-row-style">-->
            <!--<div style="position:relative">-->
              <!--<img  @click="sendClickCollect(item)" style="width:0.24rem;height:0.24rem;object-fit: fill" :src="item.collected == 1 ? '/static/collected.png':'/static/uncollected.png'"></img>-->
              <!--<img @click="skipToProfile()" v-if="showCollectTips"  style="left:-1.34rem;top:-0.52rem;position:absolute;width:1.69rem;height:0.65rem;object-fit: fill" src="/static/collect_success_tips.png"></img>-->
            <!--</div>-->
            <!--<img  hidden style="margin-left:0.2rem;width:0.24rem;height:0.24rem;object-fit: fill" src="/static/share.png"></img>-->
          <!--</div>-->
        </div>
        <div class="mw-first-text-color mw-n-line" style="margin-top:0.12rem;width:3.15rem;line-height:0.22rem;font-size:0.18rem;font-weight: bold">{{item.title}}</div>
        <div class="mw-second-text-color mw-n-line" style="width:3.15rem;line-height:0.24rem;margin-top:0.06rem;font-size:0.15rem;  -webkit-line-clamp: 6;
">{{item.description}}</div>
        <div class="mw-row-spacebetween-style" style="margin-top:0.1rem;width:3.15rem;align-items: center;">
          <div class="mw-row-style" style="align-items: center">
            <img class="mw-avatar-style"  :src="item.user.avatar == ''? '/static/defalut_avatar.png':item.user.avatar"></img>
            <div class="mw-single-line mw-third-text-color" style="margin-left:0.04rem;font-size: 0.11rem;width:0.77rem;">{{item.user.name}}</div>
          </div>
          <div class="mw-row-style" style="padding-left:0.03rem;padding-right:0.07rem;align-items: center;height:0.2rem;border-radius:0.1rem;display: flex;background-color:rgba(237,61,93,0.05)">
            <img style="height:0.14rem;width:0.14rem;" src="/static/topic_icon.png"></img>
            <div class="mw-single-line" style="margin-left:0.03rem;font-size: 0.11rem;color: #ed3d5d;max-width:0.8rem;">618</div>
          </div>
        </div>
      </div>
    </div>
    <!--<div style="border-radius:0.04rem;width:3.35rem;height:3.94rem;position: absolute;bottom:0.52rem;left:0.2rem;background-color: #ffffff">-->
      <!--<div class="mw-row-spacebetween-style" style="position: absolute;bottom:0.11rem;width:3.05rem;left:0.15rem;">-->
        <!--<div class="mw-row-style" style="align-items: center">-->
          <!--<img class="mw-avatar-style"  :src="item.user.avatar == ''? '/static/defalut_avatar.png':item.user.avatar"></img>-->
          <!--<div class="mw-single-line mw-third-text-color" style="margin-left:0.04rem;font-size: 0.11rem;width:0.77rem;">{{item.user.name}}</div>-->
        <!--</div>-->
        <!--<div class="mw-row-style" style="padding-left:0.03rem;padding-right:0.07rem;align-items: center;height:0.2rem;border-radius:0.1rem;display: flex;background-color:rgba(237,61,93,0.05)">-->
          <!--<img style="height:0.14rem;width:0.14rem;" src="/static/topic_icon.png"></img>-->
          <!--<div class="mw-single-line" style="margin-left:0.03rem;font-size: 0.11rem;color: #ed3d5d;max-width:0.8rem;">618</div>-->
        <!--</div>-->
      <!--</div>-->
      <!--<div @click.stop="sendClickBuy(item)" class="mw-column-center-style mw-main-background-red" style="position:absolute;bottom:-0.32rem;left:1.3rem;border:0.08rem solid #ffffff;height:0.6rem;width:0.6rem;border-radius:0.38rem;justify-content: center;">-->
        <!--<div class="mw-main-white" style="font-size: 0.28rem">抢</div>-->
        <!--<div class="mw-horizon-divider mw-main-background-white" style="width:0.28rem;margin-top:0.02rem;margin-bottom:0.04rem;"></div>-->
        <!--<div class="mw-main-white" style="font-size: 0.09rem;">{{item.click_total < 10000 ? item.click_total : (Math.floor(item.click_total/10000 * 10) / 10 + 'w')}}次</div>-->
      <!--</div>-->
    <!--</div>-->
    <!--<div class="mw-column-center-style" style="width:3.05rem;position: absolute;bottom:0.98rem;left:0.35rem;">-->
      <!--<img   style="width:2.65rem;height:2.65rem;object-fit:cover;border-radius:0.04rem;" :src="item.image"></img>-->
      <!--<div class="mw-row-spacebetween-style" style="margin-top:0.04rem;margin-bottom:0.04rem;width:100%;align-items: center;height:0.45rem;font-size: 0.30rem;">-->
        <!--<div class="mw-column-style" style="height:100%;justify-content: space-around">-->
          <!--<div class="mw-row-style" style="align-items: center">-->
            <!--<div class="mw-row-style mw-main-red" style="font-weight: bold;align-items: baseline">-->
              <!--<div v-if="item.coupon_amount != 0" style="font-size: 0.12rem">券后</div>-->
              <!--<div style="font-size: 0.12rem">￥</div>-->
              <!--<div style="font-size: 0.22rem">{{item.price}}</div>-->
            <!--</div>-->
            <!--<div v-if="item.coupon_amount != 0" class="mw-column-center-style" style="margin-left:0.04rem;justify-content:center;font-size:0.1rem;color:#ffffff;padding:0 0.1rem;height:0.16rem;background-image: url(/static/coupon_icon.png);background-repeat:no-repeat; background-size:100% 100%;-moz-background-size:100% 100%;}-->
<!--">{{item.coupon_amount}}元券-->
            <!--</div>-->
          <!--</div>-->

          <!--<div class="mw-row-style mw-third-text-color" style="font-size: 0.11rem">-->
            <!--<div style="margin-right:0.04rem">{{item.platform}}</div>-->
            <!--<div style="text-decoration:line-through">￥{{item.original_price}}</div>-->
          <!--</div>-->
        <!--</div>-->
        <!--<div class="mw-row-style">-->
          <!--<div style="position:relative">-->
            <!--<img  @click="sendClickCollect(item)" style="width:0.24rem;height:0.24rem;object-fit: fill" :src="item.collected == 1 ? '/static/collected.png':'/static/uncollected.png'"></img>-->
            <!--<img @click="skipToProfile()" v-if="showCollectTips"  style="left:-1.34rem;top:-0.52rem;position:absolute;width:1.69rem;height:0.65rem;object-fit: fill" src="/static/collect_success_tips.png"></img>-->
          <!--</div>-->
          <!--<img  hidden style="margin-left:0.2rem;width:0.24rem;height:0.24rem;object-fit: fill" src="/static/share.png"></img>-->
        <!--</div>-->
      <!--</div>-->
      <!--<div class="mw-first-text-color mw-n-line" style="width:100%;line-height:0.2rem;font-size:0.16rem;font-weight: bold">{{item.title}}</div>-->
      <!--<div class="mw-second-text-color mw-n-line" style="width:100%;line-height:0.16rem;margin-top:0.04rem;font-size:0.13rem;  -webkit-line-clamp: 6;-->
<!--">{{item.description}}</div>-->
    <!--</div>-->
  </div>

</template>
<script>
  import utils from '../utils'
  import httputil from '../httputil'

  export default {
    props: ['item','windowHeight','arrayindex','currentindex'],
    data() {
      return {
        showCollectTips:false,
        fullheight:0
      }
    },
    computed: {},
    watch:{
    },
    mounted(){
      this.fullheight = this.windowHeight / this.GLOBAL.ratio;
    },
    methods: {
      skipToProfile(){
        this.$replaceRouteByPath("/profile")
      },
      sendClickCollect(item){
        if (this.$getLoginStatus() && localStorage.getItem("showCollectTips")  == null) {
          this.showCollectTips = true
          localStorage.setItem("showCollectTips",this.showCollectTips)
          setTimeout(() => {
            this.showCollectTips = false
          }, 5000)
        }
        this.$emit('receiveClickCollect',item)
      },
      sendClickBuy(item){
        var that = this
        item.click_total = item.click_total + 1
        httputil.request("discount/click", {discount_id:item.id}, function (successresult) {
          that.$emit('receiveClickBuy',item)
        }, function (errorresult) {
          that.$emit('receiveClickBuy',item)
        }, "POST", true,"")
      },
      getCount(count){
        return utils.calculateCount(count)
      }
    }
  }

</script>
<style scoped>

</style>
